Fix test for bins/examples
authorAlex Crichton <alex@alexcrichton.com>
Sat, 21 Mar 2015 02:31:12 +0000 (19:31 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Sat, 21 Mar 2015 02:31:12 +0000 (19:31 -0700)
Binaries are no longer always built when examples are built, so update the test
accordingly.

tests/test_cargo_test.rs

index fe1fb414ef7de8725439c46c536c66e5adae8e30..1d3df2e89f0e3a62ca119b608780c9ed0a8eda26 100644 (file)
@@ -3,7 +3,7 @@ use std::str;
 use support::{project, execs, basic_bin_manifest, basic_lib_manifest};
 use support::{COMPILING, RUNNING, DOCTEST};
 use support::paths::CargoPathExt;
-use hamcrest::{assert_that, existing_file};
+use hamcrest::{assert_that, existing_file, is_not};
 use cargo::util::process;
 
 fn setup() {}
@@ -1245,18 +1245,24 @@ test!(example_bin_same_name {
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
-{running} `rustc [..]bin[..]foo.rs [..] --test [..]`
-{running} `rustc [..]bin[..]foo.rs [..]`
-{running} `rustc [..]examples[..]foo.rs [..]`
+{running} `rustc [..]`
+{running} `rustc [..]`
 ", compiling = COMPILING, running = RUNNING, dir = p.url()).as_slice()));
 
-    assert_that(&p.bin("foo"), existing_file());
+    assert_that(&p.bin("foo"), is_not(existing_file()));
     assert_that(&p.bin("examples/foo"), existing_file());
 
-    assert_that(p.process(&p.bin("foo")),
-                execs().with_status(0).with_stdout("bin\n"));
     assert_that(p.process(&p.bin("examples/foo")),
                 execs().with_status(0).with_stdout("example\n"));
+
+    assert_that(p.cargo_process("run"),
+                execs().with_status(0)
+                       .with_stdout(format!("\
+{compiling} foo v0.0.1 ([..])
+{running} [..]
+bin
+", compiling = COMPILING, running = RUNNING).as_slice()));
+    assert_that(&p.bin("foo"), existing_file());
 });
 
 test!(test_with_example_twice {